﻿using System;
using System.Collections.Generic;
using NUnit.Framework;
using Xenta.Plugins;

namespace Xenta.Tests.Plugins
{
    [TestFixture]
    public class PayPalStandardIPNHandlerTests : InfrastructureTest
    {
        [TestCase(false,
            "PENDING",
            "AUTHORIZATION",
            "9e879f10-f91d-4749-ae3e-baf757b2def4")]
        public void Can_HandleIPNbool(bool resend,
            string payment_status,
            string pending_reason,
            string custom)
        {
            var ipn = new Dictionary<String, String>
            {
                {"resend", resend.ToString()},
                {"payment_status", payment_status},
                {"pending_reason", pending_reason},
                {"custom", custom}
            };
            var handler = new PayPalStandardPaymentProcessor();
            var guid = Guid.Empty;

            string ret = handler.Identify(ipn, out guid);

            Assert.IsNullOrEmpty(ret);
            guid.AreEqual(Guid.Parse(custom));
        }
    }
}
